package com.aruba.flowapplyapplication.viewmodel

import android.view.View
import androidx.lifecycle.ViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

/**
 * Created by aruba on 2021/9/21.
 */
class StateFlowViewModel : ViewModel() {
    val stateFlow = MutableStateFlow<Int>(0)

    fun add(v: View) {
        stateFlow.value++
    }

    fun reduce(v: View) {
        stateFlow.value--
    }
}